package com.qige.homework;

public class JavaSE4 {
    public static void main(String[] args) {
        Teacher teacher = new Teacher("张三", "英语");
        teacher.teaching();
        Student student = new Student("王五", 59, teacher);
        student.getMyResult();
    }
}
interface Teach{
    abstract void teaching();
}
class Teacher implements Teach{
    public String name;
    public String course;

    public Teacher() {
    }

    public Teacher(String name, String course) {
        this.name = name;
        this.course = course;
    }

    @Override
    public void teaching() {
        System.out.println("我是" + name + "老师，我教" + course + "学科");
    }
}
class Student{
    public String name;
    public int score;
    public Teacher teacher;

    public Student() {
    }

    public Student(String name, int score, Teacher teacher) {
        this.name = name;
        this.score = score;
        this.teacher = teacher;
    }
    public void getMyResult(){
        System.out.println("我是学生" + name + "，我的老师是" + teacher.name + "，他教我" + teacher.course + "学科");
        if (score > 60){
            System.out.println("继续加油哦");
        }else {
            System.out.println("成绩太低了，老师" + teacher.name + "让我回去罚写100遍");
        }
    }
}